<%--
  Created by IntelliJ IDEA.
  User: bwj
  Date: 2021/6/23
  Time: 15:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>
        权限
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="css/main.css" media="all">
    <script type="text/javascript" src="lib/loading/okLoading.js"></script>
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="<%=basePath%>js/jquery.min.js" ></script>
    <link rel="stylesheet" href="fenye/myPagination.css">
    <script src="fenye/myPagination.js"></script>

</head>

<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>首页</cite></a>
              <a><cite>管理员管理</cite></a>
              <a><cite>权限管理</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"  href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form x-center" action="power/query" method="post" style="width:100%">
        <div class="layui-form-pane" style="margin-top: 15px;">
            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 100px;">用户ID</label>
                <div class="layui-input-inline">
                    <input type="text" name="yhid" id="yhid" value="${qp.yhid}"   class="layui-input">
                </div>
                <label class="layui-form-label" style="width: 100px;">用户</label>
                <div class="layui-input-inline">
                    <input type="text" name="yhm" id="yhm" value="${qp.yhm}"   class="layui-input">
                </div>

                <label class="layui-form-label" style="width: 100px;">姓名</label>

                <div class="layui-input-inline">
                    <input type="text" name="name" value="${qp.name }" id="name"   class="layui-input">
                </div>
                <label class="layui-form-label" style="width: 100px;">电话</label>

                <div class="layui-input-inline">
                    <input type="text" name="phone" value="${qp.phone }" id="phone"   class="layui-input">
                </div>
                <div class="layui-input-inline" style="width:80px">
                    <button class="layui-btn"  type="submit" ><i class="layui-icon">&#xe615;</i></button>
                </div>
            </div>
        </div>
    </form>
    <xblock>
        <button class="layui-btn" >
            查询结果
        </button>
        <span class="x-right" style="line-height:40px">共有数据：${qp.count} 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>
               用户ID
            </th>
            <th>
                用户账号
            </th>
            <th>
                用户密码
            </th>
            <th>
                用户名
            </th>
            <th>
                证件类型
            </th>
            <th>
                证件号码
            </th>

            <th>
                性别类型
            </th>
            <th>
                用户电话
            </th>
            <th>
                乘客类型
            </th>
            <th>
                联系人姓名
            </th>
            <th>
                联系人电话
            </th>
            <th>
               注册时间
            </th>
            <th>
                用户类型
            </th>
            <th>
                操作
            </th>
        </tr>
        </thead>
        <tbody id="ches">
        <c:forEach items="${usersList}" var="u">
        <tr>
            <td>
            ${u.userId}
            </td>
            <td>
                   ${u.userAccount}
            </td>
            <td>
                    ${u.userPwd}
            </td>
            <td>
                    ${u.userName}
            </td>
            <td>
                    ${u.idType.typeName}
            </td>
            <td>
                    ${u.idNumber}
            </td>
            <td>
                    ${u.sexType.typeName}
            </td>
            <td>
                    ${u.userTel}
            </td>
            <td>
                    ${u.passengerType.typeName}

            </td>
            <td>
                    ${u.contactName}

            </td>
            <td>
                    ${u.contactTle}

            </td>
            <td>
                    ${u.registerTime}

            </td>
            <td>
                    ${u.userType.typeName}
            </td>

            <td class="td-manage">
                <a title="编辑" href="javascript:;" onclick="activity_edit('编辑','power/power_details','${u.userId}','1000','600')"
                   class="ml-5" style="text-decoration:none">
                    <i class="layui-icon">&#xe642;</i>
                </a>
            </td>
        </tr>
        </c:forEach>

        </tbody>
        <tr>
            <td colspan="11" align="center">

                当前页数：${qp.page }&nbsp;&nbsp;&nbsp;&nbsp;
                <a onclick="fenye(1)">首页</a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a onclick="fenye(${qp.shangPage})">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a onclick="fenye(${qp.xiaPage})">下一页</a>&nbsp;&nbsp;&nbsp;&nbsp;
                <a onclick="fenye(${qp.pageCount})">尾页</a>&nbsp;&nbsp;&nbsp;&nbsp;
                总页数：${qp.pageCount }
            </td>
        </tr>
        <tr>
            <td colspan="11" align="center">
                <div id="pagination" class="pagination"></div>
                <script>
                    window.onload=function () {
                        new myPagination({

                            id:'pagination',
                            curPage : ${qp.page},//初始页
                            pageTotal : ${qp.pageCount},//总页数
                            pageAmount : 3,//每页多少条
                            dataTotal : ${qp.count},//总共多少条数据
                            pageSize : 3,//可选，分页个数
                            showPageTotalFlag : true,//是否显示数据统计
                            showSkipInputFlag : true,//是否支持跳转
                            getPage : function(page) {
                                //获取当前页数
                                console.log(page);
                                fenye(page);
                            }

                        })

                    }
                </script>
            </td>
        </tr>
    </table>

    <div id="page"></div>
</div>
<script src="lib/layui/layui.js" charset="utf-8"></script>
<script src="js/x-layui.js" charset="utf-8"></script>
<script>
    layui.use(['laydate','element','laypage','layer'], function(){
        $ = layui.jquery;//jquery
        laydate = layui.laydate;//日期插件
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层
        okLoading.close($);
        //以上模块根据需要引入


        var start = {
            min: '1999-06-16 23:59:59'
            ,max: '2099-06-16 23:59:59'
            ,istoday: false
            ,choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };

        var end = {
            min: laydate.now()
            ,max: '2099-06-16 23:59:59'
            ,istoday: false
            ,choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };

        document.getElementById('LAY_demorange_s').onclick = function(){
            start.elem = this;
            laydate(start);
        }
        document.getElementById('LAY_demorange_e').onclick = function(){
            end.elem = this
            laydate(end);
        }
    });


    function question_show (argument) {
        layer.msg('可以跳到前台具体问题页面',{icon:1,time:1000});
    }

    //编辑
    function activity_edit (title,url,id,w,h) {
        url = url+"/"+id;
        x_admin_show(title,url,w,h);
    }


</script>
<script type="text/javascript">
    function fenye(page) {

        var yhid=$('#yhid').val();
        var yhm=$('#yhm').val();
        var name=$('#name').val();
        var phone=$('#phone').val();
        if (yhid==""){
            yhid="!";
        }
        if (yhm==""){
            yhm="!";
        }
        if (name==""){
            name="!";
        }
        if (phone==""){
            phone="!";
        }
        var url="power/"+page+"/"+yhid+"/"+yhm+"/"+name+"/"+phone+"/fenye";
        location=url;
    }

</script>
</body>
</html>